/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.swta;

import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
 *
 * @author JKorreck
 */
public class InDecreasePanel extends Panel {

    MyItems parent;

    /**
     * @param id
     *            component id
     * @param model
     *            model for contact
     */
    public InDecreasePanel(String id, IModel model, MyItems parent) {
        super(id, model);
        this.parent = parent;

        add(new Link("increase") {

            public void onClick() {

                MyItem selected = (MyItem) (this.getParent().getDefaultModelObject());
                System.err.println("selected: " + selected);
                selected.setCount(selected.getCount() + 1);
            }
        });

        add(new Link("decrease") {

            public void onClick() {
                MyItem selected = (MyItem) (this.getParent().getDefaultModelObject());
                System.err.println("selected: " + selected);
                selected.setCount(selected.getCount() - 1);

            }
        });
    }
}
